package com.zer0.tga.art;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

public class ArtArchive {
	
	// ADD EVERYTHING!
	
	//Each art here consists of a Bitmap matrix as Bitmap[frame][direction/other/etc]
/*	public static Bitmap[][] Teemo = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] Teemo_Shroom = crop("/floortiles.png", 96, 96);
	
	
	public static Bitmap[][] Garen = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] Katarina = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] Rammus = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] Shaco = crop("/floortiles.png", 96, 96);
	
	public static Bitmap[][] Garen_DJustice = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] Shaco_Box = crop("/floortiles.png", 96, 96);
	

	public static Bitmap[][] MeleeMinion = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] CasterMinion = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] SmallGolem = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] Golem = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] SmallWolf = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] Wolf = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] Turret = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] Whelp = crop("/floortiles.png", 96, 96);	
	public static Bitmap[][] SmallWraith = crop("/floortiles.png", 96, 96);
	public static Bitmap[][] Wraith = crop("/floortiles.png", 96, 96);*/

	public static Bitmap[][] grassTile = crop("res/tileset.png",64,64);
	public static Bitmap[][] wallTile = crop("res/tileset.png",64,64);
	public static Bitmap[][] rockTile =crop("res/tileset.png",64,64);
	public static Bitmap[][] breakableRockTile = crop("res/tileset.png",64,64);
	public static Bitmap[][] brokenRockTile = crop("res/tileset.png",64,64);
	public static Bitmap[][] holeTile = crop("res/tileset.png",64,64);
	
   /* private static Bitmap[][] crop(String string, int w, int h) {
        return crop(string, w, h, 0, 0);
    }
    */
    private static Bitmap[][] crop(String string, int w, int h)
    {
    try {
        BufferedImage b = ImageIO.read(new File(string));

        int xTiles = b.getWidth() / w;
        int yTiles = b.getHeight() / h;

        Bitmap[][] result = new Bitmap[xTiles][yTiles];

        for (int x = 0; x < xTiles; x++) {
            for (int y = 0; y < yTiles; y++) {
                result[x][y] = new Bitmap(w, h);
                b.getRGB(x*w, y*h, w, h, result[x][y].pixel, 0, w);
            }
        }

        return result;
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}
}
